package com.karlis.user.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
 
import com.karlis.user.dao.UserDao;
import com.karlis.user.model.User;
 
public class UserDaoImpl extends HibernateDaoSupport implements UserDao{
 
	public void save(User user){
		getHibernateTemplate().save(user);
	}
 
	public void update(User user){
		getHibernateTemplate().update(user);
	}
 
	public void delete(User user){
		getHibernateTemplate().delete(user);
	}
 
	public User findByUsername(String username){
		List list = getHibernateTemplate().find(
                      "from User where username=?",username
                );
		return (User)list.get(0);
	}
 
}
